# coding:utf-8


class Dataset(object):
    def __init__(self):
        self.data = []

    def add(self, record):
        self.data.append(record)

    def output_label_1_attr(self, attr_name, limit=200):
        count = 0
        to_output = []
        for record in self.data:
            if record.label == 1:
                count += 1
                to_output.append(getattr(record, attr_name))
            if limit is not None and count >= limit:
                break
        sorted(to_output)
        for line in to_output:
            print(line)

    def output_label_0_attr(self, attr_name, limit=200):
        count = 0
        to_output = []
        for record in self.data:
            if record.label == 0:
                count += 1
                to_output.append(getattr(record, attr_name))
            if limit is not None and count >= limit:
                break
        sorted(to_output)
        for line in to_output:
            print(line)
